package com.bert.controller;

import java.io.File;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller

@RequestMapping("/app")
public class ShowMessageController {

	@RequestMapping("/login")
	public ModelAndView getLogin(){
		ModelAndView aux = new ModelAndView();
		aux.setViewName("Login");
		aux.addObject("msg", "HOLA");
		return aux;

	}

	@RequestMapping("/upload")
	public ModelAndView getUpload(){

		ModelAndView aux = new ModelAndView();
		aux.setViewName("Upload");
		return aux;	

	}

	@RequestMapping(value="/uploadDo", method= RequestMethod.POST)
	public ModelAndView getUpload(@RequestParam("file")File file){

		if(file!=null){
			ModelAndView aux = new ModelAndView();
			aux.setViewName("Upload");
			return aux;		
		}else{
			return null;
		}

	}
}
